 {

        var o = require("../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                layoutContent: {
                    default: null,
                    type: cc.Layout
                },
                labCoin: {
                    default: null,
                    type: cc.Label
                },
                labQuan: {
                    default: null,
                    type: cc.Label
                },
                labDiamond: {
                    default: null,
                    type: cc.Label
                },
                selectItem: {
                    default: null,
                    type: cc.Prefab
                },
                spModel: {
                    default: null,
                    type: cc.Sprite
                }
            },
            onLoad: function () {
                Global.notificationCenter.on(Global.eventName.MSG_REWARD_INFO, this.setData.bind(this), this),
                    Global.notificationCenter.on(Global.eventName.GAME_TASKS, this.onGameTasks.bind(this), this),
                    Global.roomInfoModel.getPlayModel() == Global.config.playModel.XUEZHAN ? (Global.spriteAtlas.setSpriteFrame(this.spModel, "Texture/select", "xuezhandaodi"),
                        Global.SetGameId(Global.config.GAMEID_NORMAL)) : Global.roomInfoModel.getPlayModel() == Global.config.playModel.XUELIU ? (Global.spriteAtlas.setSpriteFrame(this.spModel, "Texture/select", "xueliuchenghe"),
                        Global.SetGameId(Global.config.GAMEID_NORMAL)) : Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERREN ? (Global.spriteAtlas.setSpriteFrame(this.spModel, "Texture/select", "errenqueshen"),
                        Global.SetGameId(Global.config.GAMEID_ERREN)) : Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERRENQUICK && (Global.spriteAtlas.setSpriteFrame(this.spModel, "Texture/select", "jisu"),
                        Global.SetGameId(Global.config.GAMEID_ERRENQUICK)), this.creatRoomItem(), this.showHadDiamond();
            },
            showHadDiamond: function () {
                var e = Global.userProfile.getHadDiamondNum();
                if (console.log("showHadDiamond num", e), e && (this.labDiamond.string = e), tywx.UserInfo.isiPhone) {
                    var t = Global.utils.searchNode(this.node, "btnGoldCoin");
                    if (t) {
                        var n = Global.utils.searchNode(t, "addBtn");
                        n && (n.active = !1);
                    }
                    var o = Global.utils.searchNode(this.node, "btnDiamond");
                    if (o) {
                        var i = Global.utils.searchNode(o, "addBtn");
                        i && (i.active = !1);
                    }
                }
            },
            start: function () {
                if (cc.sys.platform == cc.sys.WECHAT_GAME) {
                    var e = Global.utils.searchComp(this.node, "shopLayout", cc.Widget);
                    if (e) {
                        var t = Global.utils.getOffsetByPhoneType();
                        e.right = t;
                    }
                }
            },
            update: function (e) {
                var t = Global.userProfile, n = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN), o = void 0,
                    i = void 0;
                if (this.labCoin && (o = this.labCoin.node.parent), this.labQuan && (i = this.labQuan.node.parent),
                o && (o.active = !0, t && t.getUserProfile())) {
                    var a = t.getUserProfile().chip;
                    Global.tableModel.getIsGameStart() && n && n.getTableCoin() && (a = n.getTableCoin()),
                        this.labCoin.string = Global.utils.exchangeToWan(a || 0);
                }
                if (i && (i.active = !0, t && t.getUserProfile())) {
                    var r = t.getHadYuanBaoNum();
                    this.labQuan.string = r || 0;
                }
            },
            onDestroy: function () {
                Global.notificationCenter.offAll(this);
            },
            onGameTasks: function (e) {
                Global.utils.hideWaitting();
                for (var t = 0; t < e.tasks.length; t++) {
                    var n = e.tasks[t];
                    if ("enter_game" == n.action) {
                        var i = n.params, a = {
                            text: i.des,
                            confirmText: "确定",
                            confirmSp: Global.spriteAtlas.getOKSpf(),
                            cancelText: "取消",
                            cancelSp: Global.spriteAtlas.getCancelSpf(),
                            confirmCallback: function () {
                                o.playEffect("select");
                                var e = i.enter_param.pluginParams.roomId;
                                if (e < 0) {
                                    cc.error("SelectController onGameTasks roomId<0");
                                    var t = {
                                        text: "金币不足，快去分享获取金币吧！",
                                        cancelSp: Global.spriteAtlas.getGoInviteSpf(),
                                        cancelText: "去邀请",
                                        cancelCallback: function () {
                                            Global.UIPopupManager.addPopup("PopupPanel/Panel_InviteFri", function (e) {
                                            });
                                        },
                                        closeCallback: function () {
                                            console.log("closeCallback");
                                        },
                                        needConfirmBtn: !1
                                    };
                                    Global.UIPopupManager.alert(t);
                                } else {
                                    Global.roomInfoModel.setRoomId(e);
                                    var n = Global.roomInfoModel.getPlayModel();
                                    Global.msgHandler.requestQuickStart(n, e);
                                }
                            },
                            cancelCallback: function () {
                                o.playEffect("select");
                            }
                        };
                        Global.UIPopupManager.alert(a);
                    }
                }
            },
            setData: function (e) {
                var t = this;
                if ("recieve" == e.action) if (e.tip) Global.utils.showNodeCommon(e.tip, 2); else {
                    var n = function () {
                        console.log("领取成功回调。。。。。"), t.doQuickStart();
                    }.bind(this);
                    e = {
                        reward: e.deltaChip,
                        name: "金币",
                        type: "freegive"
                    };
                    Global.UIPopupManager.addPopup("PopupPanel/Panel_shareGroup_Reward", function (t) {
                        t.getComponent("shareGroup_RewardPanel").setData(e, n), Global.spriteAtlas.setSpriteFrame(t.getComponent("shareGroup_RewardPanel").rewardSp, "Texture/Rewards", "WP_3");
                    });
                }
            },
            creatRoomItem: function () {
                for (var e = Global.roomInfoModel.getRooms(), t = 0, n = 0; n < e.length; n++) {
                    var o = cc.instantiate(this.selectItem);
                    this.layoutContent.node.addChild(o), o.getComponent("SelectItem").bindData(e[t], t),
                        t++;
                }
            },
            onClickBack: function () {
                if (o.playEffect("select"), Global.config.channelName != Global.config.Channel.scmjapp) {
                    Global.utils.showBanner(!1);
                    SceneHelper.loadScene("homeScene");
                } else Global.SDK.exitGame();
            },
            onClickQuickStart: function () {
                o.playEffect("select"), this.doQuickStart();
            },
            doQuickStart: function (e) {
                if (Global.utils.showWaitting(), (e = e || Global.roomInfoModel.getRecommendRoomId()) < 0) {
                    cc.error("SelectController doQuickStart roomId<0");
                    var t = {
                        text: "金币不足，快去分享获取金币吧！",
                        cancelSp: Global.spriteAtlas.getGoInviteSpf(),
                        cancelText: "去邀请",
                        cancelCallback: function () {
                            Global.UIPopupManager.addPopup("PopupPanel/Panel_InviteFri", function (e) {
                            });
                        },
                        closeCallback: function () {
                            console.log("closeCallback");
                        },
                        needConfirmBtn: !1
                    };
                    Global.UIPopupManager.alert(t);
                } else {
                    Global.roomInfoModel.setRoomId(e);
                    var n = Global.roomInfoModel.getPlayModel();
                    Global.msgHandler.requestQuickStart(n, e);
                }
            },
            onDiamondBtn: function () {
                o.playEffect("select"), tywx.UserInfo.isiPhone ? Global.utils.onBuyClickForIOS() : (console.log(" onDiamondBtn "),
                    Global.UIPopupManager.addPopup("PopupPanel/Panel_Shop", function (e) {
                        e.getComponent("ShopPanel").selectType("diamond");
                    }));
            },
            onGoldCoinBtn: function () {
                o.playEffect("select"), tywx.UserInfo.isiPhone ? Global.utils.onBuyClickForIOS() : (console.log(" onGoldCoinBtn "),
                    Global.UIPopupManager.addPopup("PopupPanel/Panel_Shop", function (e) {
                        e.getComponent("ShopPanel").selectType("coin");
                    }));
            },
            onBtnDiamond: function () {
                o.playEffect("select"), Global.UIPopupManager.addPopup("PopupPanel/Panel_Diamond_Share");
            }
        })
    }